#include<stdio.h>
struct date
{
	int year,month,day;
};
int days(struct date d)
{
	int count =0;
	int monthdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
	if((d.year%4==0&&d.year%100!=0)||(d.year%400==0))
	{
		monthdays[1]=29;
	}
	for(int i=0;i<d.month-1;i++)
	{
		count+=monthdays[i];
	}
	count+=d.day;
	return count;
}
int main()
{
	struct date d;
	scanf("%d.%d.%d",&d.year,&d.month,&d.day);
	days(d);
	printf("%d",days(d));
	return 0;
}
